<template>
  <div class="work-list">
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="id" label="用户id" align="center">
      </el-table-column>
      <el-table-column prop="userId" label="所属班级" align="center">
      </el-table-column>
      <el-table-column prop="title" label="作业情况" align="center">
      </el-table-column>
      <el-table-column prop="completed_text" label="完成情况" align="center">
      </el-table-column>
    </el-table>

    <div class="page-device">
      <PageDevice
        :currentPage="condition.page"
        :pagesize="condition.pagesize"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
  </div>
</template>

<script>
import { getTableData } from "@/utils/table";
import qs from "qs";
import PageDevice from "@/components/common/PagingDevice.vue";
import pageDeviceMixin from "@/mixins/pageDeviceMixin";

export default {
  mixins: [pageDeviceMixin],
  components: {
    PageDevice,
  },
  data() {
    return {
      tableData: [],
    };
  },
  methods: {
    async getData() {
      // console.log(qs.stringify(this.condition));
      const res = await getTableData(
        this,
        `/works?${qs.stringify(this.condition)}`
      );
      this.tableData = res.data;
      this.total = res.total;
    },
  },
  created() {
    this.getData();
  },
};
</script>

<style></style>
